import fetch from 'utils/fetch';
// 租户管理员管理 接口
// baseUser/search/{page}/{size}
export function searchPageSize(page, size, obj) {
    return fetch({
        url: `api/admin/baseUser/search5/${page}/${size}`,
        method: 'post',
        data: obj
    });
}
//运维角色查询和租户管理员角色查询admin/ group/ selectAllByType
export function getselectAllByType(page, size) {
    return fetch({
        url: `api/admin/group/selectAllByType`,
        method: 'get',
        params: {
            'type': 2
        }
    });
}

// admin/user/addUserAndMember     post           user对象，groupId角色id
//添加postAddUserAndMember
export function postAddUserAndMember(obj, id) {
    return fetch({
        url: `api/admin/user/addUserAndMember?groupId=${id}`,
        method: 'post',
        // params: { 'type': 2 },
        data: obj
    })
}
//   2.修改
//   admin/user/updateUserAndMember
//   put请求
//   传入对象和角色id
//   User user, groupId
export function putUpdateUserAndMember(roleid, userid, obj) {
    return fetch({
        url: `api/admin/user/updateUserAndMember2/${roleid}/${userid}`,
        method: 'post',
        // params: {'type':2},
        data: obj
    })
}
// user/deleteUserAndMember/{id}
//删除 admin/baseTenantInformation/{id}
export function deleteByuserId(id) {
    return fetch({
        // url: `api/adminuser/deleteUserAndMember/${id}`,
        url: `api/admin/user/deleteUserAndMember/${id}`,
        method: 'delete',
        // params:{'userId':idARR+''}
    })
}

//查角色 api/admin/group/selectAllByType?groupType=2
export function forSABT() {
    return fetch({
        url: `api/admin/group/selectAllByType?groupType=2`,
        method: 'get',
    })
}
//admin/baseTenantInformation/findByLevel
export function FindByLevel() {
    return fetch({
        url: `api/admin/baseTenantInformation/findByLevel`,
        method: 'get',
    })
}
//admin/user/findByUserId/{id}
export function FindByUserId(id) {
    return fetch({
        url: `api/admin/user/findByUserId/${id}`,
        method: 'get',
    })
}
//获得所有用户
export function SAllByType1() {
    return fetch({
        url: `api/admin/group/selectAllByType1`,
        method: 'get',
    })
}


// 用于添加租户管理员时选择租户后之间传回选择租户的角色：
// admin/group/selectByCodeAndType/{sysCompanyCode}
export function getSelectByCodeAndType(sysCompanyCode) {
    return fetch({
        url: `api/admin/group/selectByCodeAndType/${sysCompanyCode}`,
        method: 'get',
    })
}


export function getSelectByCodeAndType1(sysCompanyCode) {
    return fetch({
        url: `api/admin/group/selectByCodeAndType1/${sysCompanyCode}`,
        method: 'get',
    })
}

// 获取租户信息
// admin/baseTenantInformation/findByUNType/{type}
export function findByType() {
    return fetch({
        url: `api/admin/baseTenantInformation`,
        // api/admin/baseTenantInformation
        // url: `api/admin/baseTenantInformation/findByUNType/0`,
        method: 'get',
    })
}


// admin/baseGroupMember/selectNameByuserId/{userId}
//租户管理员页面   编辑组件查询
export function selectNameByuserId(userId) {
    return fetch({
        url: `api/admin/baseGroupMember/selectNameByuserId/${userId}`,
        method: 'get',
    })
}


// 获取当前登录用户用户名
//POST /user/getUser
export function getUser() {
    return fetch({
        url: `api/admin/user/getUser`,
        method: 'post',
    })
}
// get /TwoMessage - 首页消息的铃触发
export function TwoMessage() {
    return fetch({
        url: `api/admin/flNewLog/getLog`,
        method: 'get',
    })
}
// 首页消息的铃触发点击已读
export function ThereMessage() {
    return fetch({
        url: `api/admin/flNewLog/getReadLog`,
        method: 'get',
    })
}
// 首页消息的铃触发点击全部
export function AllMessage() {
    return fetch({
        url: `api/admin/flNewLog/getAllLog`,
        method: 'get',
    })
}
//首页搜索框请求路径
/* export function Allseasch() {
  return fetch({
    url: `api/product/flOrderManagement/getOne`,
    method: 'post',
  })
} */
// http://localhost:8762/flNewLog/DeleteLog?id=666
// 首页消息的铃触发点击全部
export function DeleteLog(id) {
    return fetch({
        url: `api/admin/flNewLog/DeleteLog?id=${id}`,
        method: 'post',
    })
}
// http://150.138.119.4:8768/flOrderManagement/getOne?BasePublic=%E7%BA%BF
// POST /flOrderManagement/getOne
// /flOrderManagement/getOne?BasePublic=1&page=1&size=50
// 主页联想搜索查询
export function getOne(BasePublic, page, size) {
    return fetch({
        url: `api/product/flOrderManagement/getOne?BasePublic=${BasePublic}&page=${page}&size=${size}`,
        method: 'post',
    })
}

// GET /baseTenantInformation/findBySysCompanyCode1
// findBySysCompanyCode1
// 操作说明
export function findBySysCompanyCode1() {
    return fetch({
        url: `api/admin/baseTenantInformation/findBySysCompanyCode1`,
        method: 'get',
    })
}

// POST /flNewLog/search/{page}/{size}
// 消息记录 条件分页查询
export function flNewLogSearch(page, size, obj) {
    return fetch({
        url: `api/admin/flNewLog/search/${page}/${size}`,
        method: 'post',
        data: obj
    })
}

// POST /flNewLog/getLogByName  flInstallApproval/findApprovalByRole
// 消息记录 查询报装审批提醒
export function getLogByName() {
    return fetch({
        url: `api/admin/flNewLog/getLogByName`,
        method: 'get'
    })
}

// get /flNewLog/getLogByName  flInstallApproval/findApprovalByRole
// 消息记录 查询经办人未审批的
export function findApprovalByRole() {
    return fetch({
        url: `api/cb/flInstallApproval/findApprovalByRole`,
        method: 'get'
    })
}

// get /flNewLog/getLogByName  flInstallApproval/findApprovalTimeOutByRole
// 查询经办人一天未审批的
export function findApprovalTimeOutByRole() {
    return fetch({
        url: `api/cb/flInstallApproval/findApprovalTimeOutByRole`,
        method: 'get'
    })
}